package com.it;

import java.util.Iterator;
import java.util.List;

import com.it.alg.DupAlgorithm;
import com.it.io.ByteArrayIOSequence;
import com.it.io.CharArrayIOSequence;
import com.it.io.IntArrayIOSequence;
import com.it.io.IteratorIOSequence;
import com.it.io.ListIOSequence;
import com.it.io.LongArrayIOSequence;
import com.it.io.ShortArrayIOSequence;
import com.it.io.FloatArrayIOSequence;
import com.it.io.DoubleArrayIOSequence;
import com.it.io.BooleanArrayIOSequence;
import com.it.io.ObjectArrayIOSequence;
import com.it.io.StringIOSequence;

public class DuplicatesHandlerImpl implements DuplicatesHandler {

	private DupAlgorithm algorithm;
	
	public DuplicatesHandlerImpl(DupAlgorithm algorithm) {
		this.algorithm = algorithm;
	}
	
	@Override
	public String eliminate(String input) {
		return algorithm.execute(() -> new StringIOSequence(), input);
	}

	@Override
	public Object[] eliminate(Object[] input) {
		return algorithm.execute(() -> new ObjectArrayIOSequence<Object>(), input);
	}

	@Override
	public char[] eliminate(char[] input) {
		return algorithm.execute(() -> new CharArrayIOSequence(), input);
	}

	@Override
	public byte[] eliminate(byte[] input) {
		return algorithm.execute(() -> new ByteArrayIOSequence(), input);
	}

	@Override
	public short[] eliminate(short[] input) {
		return algorithm.execute(() -> new ShortArrayIOSequence(), input);
	}

	@Override
	public int[] eliminate(int[] input) {
		return algorithm.execute(() -> new IntArrayIOSequence(), input);
	}

	@Override
	public long[] eliminate(long[] input) {
		return algorithm.execute(() -> new LongArrayIOSequence(), input);
	}

	@Override
	public float[] eliminate(float[] input) {
		return algorithm.execute(() -> new FloatArrayIOSequence(), input);
	}

	@Override
	public double[] eliminate(double[] input) {
		return algorithm.execute(() -> new DoubleArrayIOSequence(), input);
	}

	@Override
	public boolean[] eliminate(boolean[] input) {
		return algorithm.execute(() -> new BooleanArrayIOSequence(), input);
	}

	@Override
	public <E> Iterator<E> eliminate(Iterator<E> input) {
		return algorithm.execute(() -> new IteratorIOSequence(), input);
	}

	@Override
	public <E> List<E> eliminate(List<E> input) {
		return algorithm.execute(() -> new ListIOSequence(), input);
	}

}
